﻿app.controller('AddressCtrl', ['$scope', '$http','httpPlus',  function ($scope, $http,httpPlus) {
    $scope.editAddress = false;
    $scope.adressDetail = {};
    $scope.showDialog = false;
    $scope.currAdress = undefined;
    $scope.selectAddress = undefined;
    $scope.btnEditAddress_click = function (data) {
        $scope.editAddress = true;
        $scope.adressDetail = {
            "name": data.name,
            "tel": data.tel,
            "addressName": data.addressName,
        };
        console.log(data, $scope.editAddress);
    }
    $scope.btnCancel_click = function () {
        $scope.editAddress = false;
    }
    $scope.btnDeleteAddress_click = function (data) {
        $scope.showDialog = true;
    }
    $scope.btnCancelDialog_click = function () {
        $scope.showDialog = false;
    }

    httpPlus
        .RRRApi('address/initData')
        .then(function (data) {
            console.log(data);
            $scope.address = data;
            $scope.currAdress = $scope.address[0];
            $scope.selectAddress = $scope.currAdress.id;
        });
}]);